package WaiBao;

import java.util.Arrays;

public class MaXingXing {
        public static void main(String[] args) {
            String[] name = {"王阿毛(班长)", "张路飞(副班长)", "小李(学习委员)", "武威(文艺委员)", "李湘月", "张数轴", "李封魔", "杨茶", "李可可", "网白嫖", "李广东", "张坤",
                    "王虎", "张小五", "王空白", "王邮政", "王行", "诸葛亮", "刘昊然", "王宝强", "李大总", "张苞", "汪帮主", "懒洋洋", "张小凯", "罗翔", "刘晓燕", "刘璋",
                    "张雪峰", "马兴鑫(组织委员)"};//考生本人:马兴鑫(组织委员)
            int[] age = {18, 21, 20, 20, 22, 20, 19, 21, 21, 21, 18, 18, 20, 21, 20, 19, 18, 18, 18, 18, 19, 20, 20, 20, 21, 18, 20, 18, 20, 21};//考生本人年龄:21

            double[] mark1 = {84, 74, 81, 84, 86, 64, 76, 84, 81, 71, 74, 85, 75, 71, 74, 78, 64, 90, 74, 84, 73, 91, 75, 81, 78, 74, 85, 66, 65, 85};
            double[] mark2 = {64, 78, 85, 80, 84, 84, 77, 74, 73, 84, 85, 78, 67, 74, 85, 64, 71, 74, 77, 68, 85, 62, 65, 81, 74, 85, 75, 75, 85, 73};
            double[] mark3 = {74, 76, 75, 85, 78, 66, 74, 81, 84, 67, 63, 81, 85, 72, 68, 64, 84, 67, 66, 75, 92, 81, 91, 65, 79, 78, 74, 62, 73, 80};


            double zhifou1;//代表每个学生的总分
            double zhifou2;//代表每个学生的平均分
//            for (int i = 0; i < 30; i++) {
//            zhifou1 = mark1[i] +mark2[i] +mark3[i];
//            zhifou2 = ( zhifou1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + zhifou1);
//            System.out.println(name[i] + "的平均分为:" +zhifou2);
//        }

            double chengdu1 = 0,chengdu2 = 0;
            double[] hanyuan = new double[30];
//        for (int i = 0; i < 30; i++) {
//            chengdu1 =  mark1[i] +  mark2[i] + mark3[i];
//            chengdu2 = (chengdu1 * 1.0) / 3;
//            hanyuan[i] =chengdu2;
//        }
//
//        for (int i = 0; i <hanyuan.length - 1; i++) {
//            for (int j = 0; j < hanyuan.length - i - 1; j++) {
//                if (hanyuan[j] <hanyuan[j + 1]) {
//                    double tep = hanyuan[j];
//                    hanyuan[j] = hanyuan[j + 1];
//                    hanyuan[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(hanyuan[i]);
//        }


            double batu1 = 0,batu2 = 0, batu3 = 0;//计算每门课的平均分
            double youyou1 = 0,youyou2 = 0,youyou3 = 0;//计算每门课标准差
            double lingshi1 = 0,lingshi2 = 0,lingshi3 = 0;//计算每门课中位数
            double sum2 = 0;
            for (int i = 0; i <mark1.length; i++) {
                sum2+=mark1[i];
            }
            batu1 = (sum2*1.0)/30;
            System.out.println("生物化学的班级平均分为:"+batu1);
            double Sum = 0;
            for (int i = 0; i <mark2.length; i++) {
                Sum+=mark2[i];
            }
            batu2 = (Sum*1.0)/30;
            System.out.println("微生物学的班级平均分为:"+batu2);
            double sum = 0;
            for (int i = 0; i <mark3.length; i++) {
                sum+=mark3[i];
            }
            batu3 = (sum*1.0)/30;
            System.out.println("人体组织解剖学的班级平均分为:"+batu3);


////
            double c1 = 0,c2 = 0,c3 = 0;
            for (int i = 0; i <mark1.length; i++) {
                c1+= (mark1[i] -batu1)*(mark1[i] -batu1);
            }
            youyou1 = Math.sqrt(c1*1.0/30);
            System.out.println("生物化学的班级标准差为:"+youyou1);

            for (int i = 0; i <mark2.length; i++) {
                c2+= (mark2[i] -batu2)*(mark2[i] -batu2);
            }
            youyou2 = Math.sqrt(c2*1.0/30);
            System.out.println("微生物学的班级标准差为:"+youyou2);

            for (int i = 0; i <mark3.length; i++) {
                c3+= (mark3[i] -batu3)*(mark3[i] -batu3);
            }
            youyou3 = Math.sqrt(c3*1.0/30);
            System.out.println("人体组织解剖学的班级标准差为:"+youyou3);
////////////////////////
////////////////////////
            Arrays.sort(mark1);
            Arrays.sort(mark2);
            Arrays.sort(mark3);
            lingshi1 =(mark1[14]+mark1[15])*1.0/2;
            lingshi2 =(mark2[14]+mark2[15])*1.0/2;
            lingshi3 =(mark3[14]+mark3[15])*1.0/2;
            System.out.println("生物化学的中位数为:"+lingshi1);
            System.out.println("微生物学的中位数为:"+lingshi2);
            System.out.println("人体组织解剖学的中位数为:"+lingshi3);


        }
}
